package org.dyndns.opendemogroup.optimizer.operations;

import java.util.Random;

import org.junit.Test;

/**
 * A class to test the class MultiSigmaMutator
 */
public class MultiSigmaMutatorTest extends OperationTestBase
{

	public MultiSigmaMutatorTest ( )
	{
		super ( new MultiSigmaMutator ( 1.3 ) );
	}

	/**
	 * Tests the <i>mutate</i> method with a typical use scenario.
	 */
	@Test
	public void mutate_Typical ( )
	{
		Random randomSource = new Random ( 42 );
		double[] one =
		{
			1.0, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0
		};
		double[] two =
		{
			1.0, 1.0, 1.0, 1.0, 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0
		};
		double[] expectedChildOne =
			{
				1.1080683223356844, 1.2633164598587137, 0.46880608519082756,
				0.0921817882592717, 0.3846153846153846, 0.3846153846153846,
				0.65, 0.65, 0.7692307692307692, 0.7692307692307692, 1.3, 1.3
			};
		double[] expectedChildTwo =
			{
				1.9168290455635106, 0.7537566222255485, 0.5347521310564265,
				1.2299425036168188, 0.65, 0.3846153846153846,
				0.3846153846153846, 0.65, 1.3, 0.7692307692307692,
				0.7692307692307692, 1.3
			};
		checkPerform ( one, two, randomSource, null, expectedChildOne,
			expectedChildTwo );
	}

}
